﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Pay.Data {
    public partial class TokenBazaarProductMap
   : System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<TokenBazaarProduct> {
        public TokenBazaarProductMap() {
            ToTable("mc_TokenBazaarProduct", "dbo");

            HasKey(t => t.Id);
            Property(t => t.Id)
                .HasColumnName("Id")
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
                .IsRequired();
            Property(t => t.Price)
               .HasColumnName("Price").HasPrecision(18, 6)
              .IsRequired();
            Property(p => p.RowVersion).IsRowVersion();
            //Relationships
            HasRequired(t => t.Category)
              .WithMany()
              .HasForeignKey(d => d.CategoryId)
              .WillCascadeOnDelete(false);
            HasRequired(t => t.Merchant)
            .WithMany()
            .HasForeignKey(d => d.MerchantId)
            .WillCascadeOnDelete(false);
        }
    }
}
